package leetcode;

import java.util.*;

/**
 * @program: datastructureandalogorithm
 * @description:
 * @author: hmx
 * @create: 2021-12-05 10:30
 **/
public class LeetCode5942 {

    public int[] findEvenNumbers(int[] digits) {

        int size = digits.length;
        Set<Integer> set = new HashSet<>();
        for (int i = 0; i < size; i++) {
            if (digits[i] != 0) {
                for (int j = 0; j < size; j++) {
                    if (j != i) {
                        for (int k = 0; k < size; k++) {
                            if (k != i && k != j && digits[k] % 2 == 0) {
                                int num = digits[k] + digits[j] * 10 + digits[i] * 100;
                                set.add(num);
                            }
                        }
                    }

                }
            }
        }
        int len = set.size();
        int[] res = new int[len];
        int index = 0;
        for (Integer integer : set) {
            res[index++] = integer;
        }
        Arrays.sort(res);
        return res;
    }

}
